package com.hyz.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;


@Data
@ApiModel("返回结果统一实体类")
public class AgencyResult implements Serializable {
    @ApiModelProperty("操作成功与否标识   0：失败 1：成功")
private Integer code;

    @ApiModelProperty("返回一些提示信息")
    private String msg;

    @ApiModelProperty("返回所需的数据或者对象")
    private Object data;

    public static AgencyResult error(String msg){
        AgencyResult agencyResult = new AgencyResult();
        agencyResult.code=0;
        agencyResult.msg=msg;
        return agencyResult;
    }
    public static AgencyResult success(String msg,Object obj){
        AgencyResult agencyResult = new AgencyResult();
        agencyResult.code=1;
        agencyResult.msg=msg;
        agencyResult.data=obj;
        return agencyResult;
    }
    public static AgencyResult success(String msg){
        AgencyResult agencyResult = new AgencyResult();
        agencyResult.code=1;
        agencyResult.msg=msg;
        return agencyResult;
    }
}
